package com.yashi.springmvcjbpm.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.yashi.springmvcjbpm.entity.Leave;
import com.yashi.springmvcjbpm.service.impl.JBPMServiceImpl;



@Controller
public class DetailController {
	private List<Leave> leaveList = new ArrayList<Leave>();
	private JBPMServiceImpl jbpmServiceImpl = new JBPMServiceImpl();
	@RequestMapping("/detailAction")
	public String execute(String taskId,HttpServletRequest request){
		 System.out.println("taskId : " + taskId);  
		leaveList=jbpmServiceImpl.getLeaveDetail(taskId);		//根据任务Id从库表获取相应的记录详细情况
		request.setAttribute("leaveList", leaveList);
		request.setAttribute("taskId", taskId);
		return "taskDetail";
	}
	
	@RequestMapping(value="/reDetailAction")
	public String reRequest(String taskId,HttpServletRequest request){
		leaveList=jbpmServiceImpl.getLeaveDetail(taskId);
		request.setAttribute("leaveList", leaveList);
		request.setAttribute("taskId", taskId);
		return "reRequest";
	}
	
}
